//
//  JAChannelModel.m
//  网易新闻
//
//  Created by Arvin on 17/3/18.
//  Copyright © 2017年 Arvin. All rights reserved.
//

#import "JAChannelModel.h"
#import <YYModel.h>

@implementation JAChannelModel

+(NSArray *)channelModelArr{
    //获取频道json的二进制数据
    NSData *data = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"topic_news.json" withExtension:nil]];
    NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:0 error:NULL];
    NSArray *dicArr = dic[@"tList"];
    NSArray *modelArray = [NSArray yy_modelArrayWithClass:[JAChannelModel class] json:dicArr];
    
    //对频道进行排序,对于有返回值api,生成的是一个新的对象
    modelArray = [modelArray sortedArrayUsingComparator:^NSComparisonResult(JAChannelModel * obj1, JAChannelModel * obj2) {
        return [obj1.tid compare:obj2.tid];
    }];
    return modelArray;
}

-(NSString *)description{
    return [self yy_modelDescription];
}

@end
